Skip to content

docs(skills): objectstack-automation spells an expression approver's value as the plain CEL string the schema accepts - #37369

Merged
os-zhuang merged 1 commit into
mainfrom
claude/issue-37353-approver-expression-string
Nov 26, 2026
Merged

os-zhuang merged 1 commit into
mainfrom
claude/issue-37353-approver-expression-string

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Bill · project thread

Fixes #37353

Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:用 AI 搭建审批流程时,AI 读到的技能说明里「动态审批人」的三个示例,现在把表达式写成普通文字;以前照抄旧示例会被校验拒绝。只有文字变化。
  • 为什么做:替照着已发布技能说明写审批流程的 AI 和应用开发者解决问题,他们抄到的示例过不了校验。
  • 出错会怎样:最坏是示例仍写得不准,照抄的人会被校验拦住并看到明确报错;撤回即恢复旧文字。
  • 要你做什么:受治理的技能文件,需要你批准后合并。

What changes

skills/objectstack-automation/references/state-machines-and-approvals.md, Dynamic approvers:

  • The three fragments wrote an expression approver's value with the cel tag. The tag builds a { dialect, source } object, and ApprovalNodeApproverSchema.value is a string, so a node copied from them was refused. They now read value: 'current.co_review_departments', value: 'vars.lead_review.next_reviewers' and value: 'current.picked_departments'. type: 'expression' and resolveAs are unchanged.
  • The expression row of the approver table now says value is "the expression string" (it said "the expression").

A changeset for @objectstack/skills (patch) carries both declaration lines.

Skill size (lines; tokens are the ratchet's ceil(bytes / 4)):

Reading Before After
The edited file, lines 386 386
The edited file, tokens (ceiling 5936, unchanged) 5934 5933
All SKILL.md files, lines 4948 4948
Ratcheted bundle, tokens 198145 198144

Net lines added under skills/**: 0 (4 changed in place). The file is 2 bytes shorter, so nothing had to be paid for.

Tests

No test file changes: the diff is skill prose and a changeset. The accepted form was measured against the built spec at 5e32f8cc93:

Schema probe, built @objectstack/spec
1 string OK
2 string OK
3 string cfg OK
1 cel REFUSED [["value","Invalid input: expected string, received object"]]
3 cel cfg REFUSED [["approvers.0.value","Invalid input: expected string, received object"]]

Rows 1 to 3 are the three fragments as now written, parsed by ApprovalNodeApproverSchema (1, 2) and ApprovalNodeConfigSchema (3). The two cel rows are the old spelling.

Acceptance notes

  • The accepted form is a plain CEL string. packages/spec/src/automation/approval.zod.ts declares value: z.string().optional(); its description says "write the CEL expression that returns the approvers", and the comment above it says the designer renders a plain text input for the CEL source. Every approver-expression fixture in packages/lint/src/validate-approval-approvers.test.ts passes a string, the lint hint prescribes { type: 'expression', value: 'CEL-SOURCE', … } (placeholder spelled in words), examples/app-showcase/src/automation/flows/dynamic-approval.flow.ts writes a string, and the compiled end-to-end flow a few lines below the fragments in this same file already wrote value: 'vars.lead_review.next_reviewers'. Nothing in the tree passes a cel object here, so the card's stop condition did not apply.
  • Possible spec-lane follow-up, not filed. ADR-0032 §2 says expression fields are typed and "Never a raw string". The approver value is one field shared by every approver type (a user id, a position name, a field name, or CEL), which is why it is a string today. Whether it should accept the { dialect, source } envelope for expression is a contract question for the spec lane. This PR does not touch spec.
  • The sentence at line 76 stays as written. It says the cel tag "builds each { dialect, source } envelope" of the flow example above it (start and edge conditions, the filter). The approver value is not an envelope, so the sentence is still true; the table row now states the approver case where an author reads it.
  • Serial note. An open draft pull request for the same skill directory edits other files; the claim's overlap check found this file merges cleanly with it. origin/main was still at this branch's base (98bda0ac17) when this was opened, so there was nothing to merge.

Verification

Read first:

  1. skills/objectstack-automation/references/state-machines-and-approvals.md, the code block under Dynamic approvers (the three value: lines are the whole risk).
  2. The expression row of the approver table in the same file.

Two-minute check: node scripts/check-skills-token-ratchet.mjs prints state-machines-and-approvals.md 5933 / 5936 (-3) and exits 0.

Local gates at 5e32f8c

node scripts/pm/dispatch-gates.mjs --commands derived 49 commands. 47 ran and exited 0, among them:

✓ check-skills-token-ratchet: skills/objectstack-automation/references/state-machines-and-approvals.md is 5933 tokens (ceiling 5936; headroom 3).
✓ check-skill-served-sections: 24 served section(s), each heading exactly once in its file (6 json, 2 json+ts, 16 neutral); 10 JSON fence(s) parse and pass their spec validators.
✓ check:doc-formula-expressions: 29 record-scoped formula example(s) across 596 files / 1873 TS blocks judged clean by @objectstack/formula.
✅ 10 generated files in sync with packages/spec   (check:skill-refs)
✓ doc authoring guard: 23656 customer-facing string(s) across 1879 spec sources clean

NOT MEASURED: pnpm check:dual-build-cjs-loads and pnpm check:lean-entry-closure both exited 3 with PREREQUISITE NOT MET (they load every package's built dist/; only spec, formula and lint were built here). Neither reads a skill file. CI runs both.

🤖 Generated with Claude Code

…three objectstack-automation fragments

Claude-Session: https://claude.ai/code/session_01Utp6CZmwqAVSYHM1nQUDTq
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/s documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 25, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CZmwqAVSYHM1nQUDTq

Final green head: 5e32f8cc93b4dd726967fa692aa9913bf5529bec · 2026-11-26T00:20Z

  • Check-runs on this head: 28 success, 16 skipped, 0 failed, 0 pending.
  • Files: skills/objectstack-automation/references/state-machines-and-approvals.md, .changeset/37353-approver-expression-string.md (+14/−4).
  • Governed surface (skills/**) ⇒ Tier H: draft stays draft; zone o5-A sends this head to seat repo:objectstack#5 for L1 and the contract-tier L2, then the seat's hand-off.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X

Contract-review-claim: session_01Utp6CYtTDvfPQDzMbZnN5X · head 5e32f8c · 2026-11-26T00:21Z

The seat runs the at-tier contract review of this head through an isolated sub-agent; L1 is the seat's own.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 5e32f8cc93b4dd726967fa692aa9913bf5529bec
Local-runs: none
Scope: skills/objectstack-automation/references/state-machines-and-approvals.md + none
Security-touching: yes
Rule-change-verified: none

① Derived judgments

  • Accept-set: unchanged — right. The diff is one skill reference (4 lines changed in place) and one changeset. No schema, runtime, gate or test file is in it, so nothing the platform accepts or refuses moves.
  • Public surface: the published objectstack-automation skill text — right. The three expression approver fragments under Dynamic approvers now write value as a plain CEL string, and the expression row of the approver table says value = "the expression string". Read against main (02520ab4; the file and approval.zod.ts are unchanged there since the branch base 98bda0ac):
    • ApprovalNodeApproverSchema.value is z.string().optional() (packages/spec/src/automation/approval.zod.ts:588), its description says "write the CEL expression that returns the approvers", and the comment above it says the designer renders a plain input for the CEL source.
    • The cel tag returns { dialect: 'cel', source } (packages/spec/src/shared/expression.zod.ts:490), an object, so the old spelling could not satisfy z.string().
    • The runtime reads the value as text: resolveExpressionApprovers takes String(a.value ?? '').trim() and builds the envelope itself (packages/plugins/plugin-approvals/src/approval-service.ts:3610, :3634).
    • The lint fixtures and the showcase flow (examples/app-showcase/src/automation/flows/dynamic-approval.flow.ts:58) pass a string, as does the compiled end-to-end flow lower in this same file.
  • Card stop condition (the contract means a cel object): did not apply — right. Nothing on main passes or accepts an envelope in this slot.
  • Residual spellings: none. At the head no file under skills/, content/, docs/ or any .md/.mdx spells an approver value with the cel, P or F tag. The one remaining cel mention in the file is line 76.
  • Line 76 left as written — right. It says the tag builds each { dialect, source } envelope of the flow example it follows; that JSON carries envelopes in the start condition, the edge conditions and the filter, and its approvers are position strings. The sentence makes no claim about approver value.
  • Size claims — right. Each fragment loses 3 bytes (9 in all) and the table row gains 7: 23734 to 23732 bytes, 386 lines both sides, ceil(23732 / 4) = 5933 against the unchanged ceiling 5936 (scripts/check-skills-token-ratchet.mjs:1865).
  • Gates. 44 check-runs on the head: 28 success, 16 skipped, none failed or pending. Lint & Repo Gates, Lint · docs & code guards, Check Changeset, Governed Surface Queue Guard, Test Core and Build Core are success. No name appears twice.

② Semver level

  • @objectstack/skills: patch matches what the diff publishes: a correction to shipped skill prose, no API or schema change.
  • Clause-②: no and Metadata-protocol: none are on the PR body, the changeset and the claim, and agree. The diff adds no capability and narrows none, so no is right.
  • Changeset wording checked: the error text expected string, received object is the tail of the zod message Invalid input: expected string, received object; "two bytes shorter" and "token ceiling unchanged" hold (see ①).

③ Boundary flags

  • open_questions: empty. Nothing to answer.
  • Deviation, changeset outside the claim's File surface: accepted. AGENTS.md requires it for a published package; it is the only file beyond the claimed one.
  • Out-of-scope finding, ADR-0032 §2 ("Never a raw string", docs/adr/0032-unified-expression-layer.md:71) against value: z.string(): escalated to the seat. The dev recorded it in the PR body and filed nothing. It is a real tension and not this PR's to settle: value is one polymorphic slot shared by every approver type, and the schema comment states the string is deliberate until an expression editor lands. The seat should either file a spec-lane card or record that the comment in approval.zod.ts is the standing answer. It does not block this PR.
  • Local-gate gaps (check:dual-build-cjs-loads, check:lean-entry-closure not measured locally): closed by CI. Both run under the green lint and build check-runs on this head, and neither reads a skill file.
  • Serial note (docs(skills): objectstack-data and objectstack-automation SKILL.md become routers #36158). The card asks to land after docs(skills): objectstack-data and objectstack-automation SKILL.md become routers #36158 or merge main. main has moved from 98bda0ac to 02520ab4 with no change to this file; landing order is the seat's call.
  • Security-touching: yes, kept deliberately. The changed hunks teach how a flow names who may approve, which is authorisation behaviour. The correction itself weakens nothing, but the low-risk arm's test is what the hunk teaches, so this PR stays at Tier H for the maintainer, as its body already says.
  • Rule-change-verified: none. No .claude/** path is touched and no hunk alters what an agent may do, the order of work, or what goes to the maintainer.
  • SQL push-down: not applicable. No query, id materialisation or join is in the diff.

④ Design judgment

skills/objectstack-automation/references/state-machines-and-approvals.md holds against the spec it teaches and against the card's scenario (an author or agent copies a dynamic-approver fragment and it must validate). All three fragments now parse by reading: fragments ① and ② are ApprovalNodeApproverSchema literals with a string value and a resolveAs inside the enum user | department | position | team; fragment ③ is an ApprovalNodeConfigSchema literal whose approver has the same shape. The roots used (current.*, vars.*) are in the closed set the runtime enforces, and fragment ② now matches the compiled os:check flow below it character for character, which removes the internal contradiction the file carried.

No must-fix and no should-fix. Nits, none affecting correctness or the contract:

  • nit: the fragments are fenced as typescript with no import and no tag in them now, so nothing in the block explains why this one expression slot takes a quoted string while every flow condition takes an envelope. The table row ("value = the expression string") carries it; a reader who lands on the code block alone gets no cue. The ratchet has 3 tokens of headroom, so a cue would have to be paid for; leaving it is defensible.
  • nit: the PR body's "two-minute check" quotes the ratchet's output line verbatim; the arithmetic behind it is confirmed here, the exact print format was not run (read-only review).
  • nit: the changeset quotes the error without its Invalid input: prefix. Accurate as a fragment.

Implemented-by: claude/issue-37353-approver-expression-string
Reviewed-by: session_01Utp6CYtTDvfPQDzMbZnN5X

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X

维护者速读

  • 改了什么:自动化技能里「动态审批人」三段示例原来把 expression 审批人的 value 写成 cel 标签对象,照抄会校验失败;现改成 schema 接受的普通 CEL 字符串,表格一行同步说明。
  • 为什么:ApprovalNodeApproverSchema.value 是字符串,运行时自己包装表达式;示例与 schema 不一致会误导 AI 生成坏的审批流。
  • 风险:纯文档,技能文件少 2 字节,token 上限不变;不改任何代码或 schema。
  • 要你做什么:批准合并。契约复核 PASS 在评论 7178736042,Head-sha 5e32f8cc93b4dd726967fa692aa9913bf5529bec。

席位意见:ACCEPT。三处示例都按 schema 与运行时核过,仓内无残留写法;契约复核无必改项。

席位核对

Head-sha: 5e32f8cc93b4dd726967fa692aa9913bf5529bec
ACCEPT — L1, seat repo:objectstack#5

  1. Shape: open draft against main, 2 files (+14/−4). The first line Fixes #37353 holds, because merging delivers the whole card: all three fragments are corrected, and the table row says value is the expression string. No closing keyword binds another card. l1-face CLEAN, 13 items.
  2. Premise measured (contract record):
    • ApprovalNodeApproverSchema.value is z.string().optional() (packages/spec/src/automation/approval.zod.ts:588).
    • The cel tag builds { dialect, source } (packages/spec/src/shared/expression.zod.ts:490).
    • resolveExpressionApprovers reads String(a.value ?? '') and builds the envelope itself (packages/plugins/plugin-approvals/src/approval-service.ts:3610).
    • No other approver value under skills/, content/ or docs/ is spelt with a tag.
    • Line 76 is still true: it describes the flow JSON's condition envelopes.
  3. Gates: check-runs at 5e32f8cc93: 28 success, 16 expected skip, 0 failed, 0 pending. Lint & Repo Gates and TypeScript Type Check are success. The changeset was read sentence by sentence against the diff and is true: 23734 → 23732 bytes, 5933 tokens against the unchanged ceiling 5936.
  4. Accepted deviations:
    • (a) The changeset sits outside the claim's file-surface line, which AGENTS.md requires.
    • (b) Contract nits N1 to N3: there is no in-block cue for why this slot takes a quoted string, the ratchet print format was not run, and the error is quoted without its Invalid input: prefix.
  5. Out of scope and where it went: ADR-0032 §2 ("never a raw string") vs value: z.string() goes to a follow-up card the area files under the parent, for the spec lane to judge. Landing order: docs(skills): objectstack-data and objectstack-automation SKILL.md become routers #36158 shares the file and is still a draft, and overlap-check reads a clean merge, so this PR does not wait on it.
  6. Landing terms: Tier H (skills/**), whole PR. L2 at CONTRACT_REVIEW_TIER: PASS, comment 7178736042, same head, no must-fix, no should-fix. Security-touching: yes, because it teaches how a flow names who may approve; no logic changes. It waits for the approver, and the seat lands it after approval (ready, auto-merge, queue).

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X

Approval requested (Tier H, skills/**). Seat ACCEPT: comment 7178750958. Contract review PASS at CONTRACT_REVIEW_TIER: comment 7178736042, Head-sha 5e32f8cc93b4dd726967fa692aa9913bf5529bec. After approval the seat lands it.

@objectstack-fleet objectstack-fleet Bot added the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 26, 2026
@os-zhuang
os-zhuang marked this pull request as ready for review November 26, 2026 00:39
@os-zhuang
os-zhuang added this pull request to the merge queue Nov 26, 2026
Merged via the queue into main with commit 79fcbe2 Nov 26, 2026
50 checks passed
@os-zhuang
os-zhuang deleted the claude/issue-37353-approver-expression-string branch November 26, 2026 01:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue size/s tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

skills(objectstack-automation): three approver examples spell value: cel…, which ApprovalNodeApproverSchema refuses (value is a string)

3 participants